package org.devf.fork.imsimulator.play;


import cn.hutool.core.io.resource.ResourceUtil;

import java.io.File;
import java.net.URISyntaxException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class MusicPlayer {

	private static final ExecutorService executorService =  new ThreadPoolExecutor(1, 1,
			10L, TimeUnit.SECONDS,
			new LinkedBlockingQueue<Runnable>(100),
			new ThreadPoolExecutor.AbortPolicy());

	public static void play(TipAudioEnum tipAudioEnum){
		try {
			executorService.submit(new PlayThread(new File(ResourceUtil.getResource(tipAudioEnum.getFileName()).toURI())));
		} catch (URISyntaxException e) {
			e.printStackTrace();
		}
	}
}
	
